<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>政务管理系统 - 登录</title>
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        body {
            font-family: 'Microsoft YaHei', 'PingFang SC', 'Helvetica Neue', Arial, sans-serif;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            min-height: 100vh;
            display: flex;
            align-items: center;
            justify-content: center;
            padding: 20px;
        }

        .login-container {
            background: rgba(255, 255, 255, 0.95);
            backdrop-filter: blur(10px);
            border-radius: 20px;
            box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
            padding: 40px;
            width: 100%;
            max-width: 400px;
            border: 1px solid rgba(255, 255, 255, 0.2);
            animation: slideIn 0.6s ease-out;
        }

        @keyframes slideIn {
            from {
                opacity: 0;
                transform: translateY(30px);
            }
            to {
                opacity: 1;
                transform: translateY(0);
            }
        }

        .login-header {
            text-align: center;
            margin-bottom: 30px;
        }

        .login-logo {
            width: 80px;
            height: 80px;
            background: linear-gradient(135deg, #1e3a8a, #3b82f6);
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            margin: 0 auto 20px;
            color: white;
            font-size: 32px;
            font-weight: bold;
            box-shadow: 0 8px 20px rgba(59, 130, 246, 0.3);
        }

        .login-title {
            font-size: 24px;
            font-weight: 600;
            color: #1e3a8a;
            margin-bottom: 8px;
        }

        .login-subtitle {
            font-size: 14px;
            color: #6b7280;
        }

        .login-form {
            display: flex;
            flex-direction: column;
            gap: 20px;
        }

        .form-group {
            position: relative;
        }

        .form-label {
            display: block;
            font-size: 14px;
            font-weight: 500;
            color: #374151;
            margin-bottom: 8px;
        }

        .form-input {
            width: 100%;
            padding: 12px 16px;
            border: 2px solid #e5e7eb;
            border-radius: 10px;
            font-size: 16px;
            transition: all 0.3s ease;
            background: white;
        }

        .form-input:focus {
            outline: none;
            border-color: #3b82f6;
            box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
        }

        .form-input.error {
            border-color: #ef4444;
        }

        .password-toggle {
            position: absolute;
            right: 12px;
            top: 50%;
            transform: translateY(-50%);
            background: none;
            border: none;
            cursor: pointer;
            color: #6b7280;
            font-size: 18px;
            padding: 4px;
        }

        .password-toggle:hover {
            color: #374151;
        }

        .form-options {
            display: flex;
            justify-content: space-between;
            align-items: center;
            font-size: 14px;
        }

        .remember-me {
            display: flex;
            align-items: center;
            gap: 8px;
            color: #6b7280;
        }

        .remember-me input[type="checkbox"] {
            width: 16px;
            height: 16px;
            accent-color: #3b82f6;
        }

        .forgot-password {
            color: #3b82f6;
            text-decoration: none;
            font-weight: 500;
        }

        .forgot-password:hover {
            text-decoration: underline;
        }

        .login-btn {
            width: 100%;
            padding: 14px;
            background: linear-gradient(135deg, #1e3a8a, #3b82f6);
            color: white;
            border: none;
            border-radius: 10px;
            font-size: 16px;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.3s ease;
            position: relative;
            overflow: hidden;
        }

        .login-btn:hover {
            transform: translateY(-2px);
            box-shadow: 0 8px 20px rgba(59, 130, 246, 0.3);
        }

        .login-btn:active {
            transform: translateY(0);
        }

        .login-btn.loading {
            pointer-events: none;
        }

        .login-btn.loading::after {
            content: '';
            position: absolute;
            width: 20px;
            height: 20px;
            top: 50%;
            left: 50%;
            margin-left: -10px;
            margin-top: -10px;
            border: 2px solid transparent;
            border-top: 2px solid white;
            border-radius: 50%;
            animation: spin 1s linear infinite;
        }

        @keyframes spin {
            0% { transform: rotate(0deg); }
            100% { transform: rotate(360deg); }
        }

        .error-message {
            background: #fee2e2;
            color: #dc2626;
            padding: 12px;
            border-radius: 8px;
            font-size: 14px;
            margin-bottom: 20px;
            display: none;
            border: 1px solid #fecaca;
        }

        .success-message {
            background: #d1fae5;
            color: #059669;
            padding: 12px;
            border-radius: 8px;
            font-size: 14px;
            margin-bottom: 20px;
            display: none;
            border: 1px solid #a7f3d0;
        }

        .demo-credentials {
            background: #eff6ff;
            border: 1px solid #dbeafe;
            border-radius: 10px;
            padding: 15px;
            margin-top: 20px;
        }

        .demo-credentials h4 {
            color: #1e3a8a;
            font-size: 14px;
            margin-bottom: 10px;
        }

        .demo-credentials p {
            color: #6b7280;
            font-size: 12px;
            margin-bottom: 5px;
        }

        .demo-credentials strong {
            color: #374151;
        }

        @media (max-width: 480px) {
            .login-container {
                padding: 30px 20px;
                margin: 10px;
            }

            .login-title {
                font-size: 20px;
            }

            .login-logo {
                width: 60px;
                height: 60px;
                font-size: 24px;
            }
        }
    </style>
</head>
<body>
    <div class="login-container">
        <div class="login-header">
            <div class="login-logo">政</div>
            <h1 class="login-title">政务管理系统</h1>
            <p class="login-subtitle">Government Management System</p>
        </div>

        <div class="error-message" id="error-message"></div>
        <div class="success-message" id="success-message"></div>

        <form class="login-form" id="login-form">
            <div class="form-group">
                <label class="form-label" for="username">用户名</label>
                <input type="text" id="username" class="form-input" placeholder="请输入用户名" required>
            </div>

            <div class="form-group">
                <label class="form-label" for="password">密码</label>
                <input type="password" id="password" class="form-input" placeholder="请输入密码" required>
                <button type="button" class="password-toggle" onclick="togglePassword()">👁️</button>
            </div>

            <div class="form-options">
                <label class="remember-me">
                    <input type="checkbox" id="remember-me">
                    <span>记住我</span>
                </label>
                <a href="#" class="forgot-password" onclick="forgotPassword()">忘记密码？</a>
            </div>

            <button type="submit" class="login-btn" id="login-btn">
                登录
            </button>
        </form>

        <div class="demo-credentials">
            <h4>演示账号</h4>
            <p><strong>管理员账号：</strong>admin / admin123</p>
            <p><strong>普通用户：</strong>user / user123</p>
        </div>
    </div>

    <script>
        // 切换密码显示/隐藏
        function togglePassword() {
            const passwordInput = document.getElementById('password');
            const toggleBtn = document.querySelector('.password-toggle');
            
            if (passwordInput.type === 'password') {
                passwordInput.type = 'text';
                toggleBtn.textContent = '🙈';
            } else {
                passwordInput.type = 'password';
                toggleBtn.textContent = '👁️';
            }
        }

        // 忘记密码
        function forgotPassword() {
            alert('忘记密码功能\n\n请联系系统管理员重置密码，\n或发送邮件至：admin@gov.cn');
        }

        // 显示错误信息
        function showError(message) {
            const errorDiv = document.getElementById('error-message');
            errorDiv.textContent = message;
            errorDiv.style.display = 'block';
            
            // 3秒后自动隐藏
            setTimeout(() => {
                errorDiv.style.display = 'none';
            }, 3000);
        }

        // 显示成功信息
        function showSuccess(message) {
            const successDiv = document.getElementById('success-message');
            successDiv.textContent = message;
            successDiv.style.display = 'block';
            
            // 3秒后自动隐藏
            setTimeout(() => {
                successDiv.style.display = 'none';
            }, 3000);
        }

        // 表单验证
        function validateForm() {
            const username = document.getElementById('username').value.trim();
            const password = document.getElementById('password').value.trim();
            
            if (!username) {
                showError('请输入用户名');
                document.getElementById('username').classList.add('error');
                return false;
            }
            
            if (!password) {
                showError('请输入密码');
                document.getElementById('password').classList.add('error');
                return false;
            }
            
            // 移除错误样式
            document.getElementById('username').classList.remove('error');
            document.getElementById('password').classList.remove('error');
            
            return true;
        }

        // 模拟登录验证
        function validateCredentials(username, password) {
            // 演示账号验证
            const validCredentials = {
                'admin': 'admin123',
                'user': 'user123',
                'zhangsan': 'zhangsan123',
                'lisi': 'lisi123'
            };
            
            return validCredentials[username] === password;
        }

        // 处理登录
        function handleLogin(username, password) {
            const loginBtn = document.getElementById('login-btn');
            loginBtn.classList.add('loading');
            loginBtn.textContent = '登录中...';
            
            // 模拟网络延迟
            setTimeout(() => {
                if (validateCredentials(username, password)) {
                    showSuccess('登录成功！正在跳转...');
                    
                    // 保存登录状态
                    localStorage.setItem('isLoggedIn', 'true');
                    localStorage.setItem('currentUser', username);
                    localStorage.setItem('loginTime', new Date().toISOString());
                    
                    // 跳转到主系统
                    setTimeout(() => {
                        window.location.href = 'index.html';
                    }, 1500);
                } else {
                    showError('用户名或密码错误，请重试');
                    loginBtn.classList.remove('loading');
                    loginBtn.textContent = '登录';
                }
            }, 1500);
        }

        // 表单提交事件
        document.getElementById('login-form').addEventListener('submit', function(e) {
            e.preventDefault();
            
            if (!validateForm()) {
                return;
            }
            
            const username = document.getElementById('username').value.trim();
            const password = document.getElementById('password').value.trim();
            
            handleLogin(username, password);
        });

        // 输入框焦点事件
        document.getElementById('username').addEventListener('focus', function() {
            this.classList.remove('error');
        });
        
        document.getElementById('password').addEventListener('focus', function() {
            this.classList.remove('error');
        });

        // 页面加载时检查是否已登录
        window.addEventListener('load', function() {
            const isLoggedIn = localStorage.getItem('isLoggedIn');
            if (isLoggedIn === 'true') {
                // 如果已登录，直接跳转到主系统
                window.location.href = 'index.html';
            }
        });
    </script>
</body>
</html>
